import logging

from replace_complex_fn_date_add import rep_complex_fn_date_add
from replace_complex_fn_group_concat import rep_complex_fn_group_concat
from replace_complex_fn_unix_timestamp import rep_complex_fn_unix_timestamp
from replace_complex_fn_date_format import rep_complex_fn_date_format
from replace_complex_fn_from_unixtime import rep_complex_fn_from_unixtime
from replace_complex_fn_str_to_date import rep_complex_fn_str_to_date
from replace_complex_fn_date_sub import rep_complex_fn_date_sub
from replace_complex_fn_if import rep_complex_fn_if


def replace_complex_main(document_content):
    logging.info(" 开始调用 「replace_complex_main」 进行复杂函数替换 ")



    # all_the_text = rep_unix_timestamp_by_re(all_the_text)
    # (1) 复杂函数 unix_timestamp 替换
    document_content = rep_complex_fn_unix_timestamp(document_content)

    # (2) 复杂嵌套的 date_sub 函数
    document_content = rep_complex_fn_date_sub(document_content)

    # (3) 复杂嵌套的 date_add 函数
    document_content = rep_complex_fn_date_add(document_content)

    # (4) 复杂嵌套的 date_format 函数
    document_content = rep_complex_fn_date_format(document_content)

    # (5) 复杂嵌套的 from_unixtime 函数
    document_content = rep_complex_fn_from_unixtime(document_content)

    # (6) rep_complex_fn_str_to_date
    document_content = rep_complex_fn_str_to_date(document_content)

    # (7) 带有嵌套的if 替换
    document_content = rep_complex_fn_if(document_content)

    # (8) group_concat 替换
    document_content = rep_complex_fn_group_concat(document_content)

    logging.info(" 结束调用 「replace_complex_main」 进行复杂函数替换 ")
    return document_content
